}
});
+const OverviewShownState = {
+ HIDDEN: 'HIDDEN',
+ HIDING: 'HIDING',
+ SHOWING: 'SHOWING',
+ SHOWN: 'SHOWN',
+};
+
+const OVERVIEW_SHOWN_TRANSITIONS = {
+ [OverviewShownState.HIDDEN]: {
+ signal: 'hidden',
+ allowedTransitions: [OverviewShownState.SHOWING],
+ },
+ [OverviewShownState.HIDING]: {
+ signal: 'hiding',
+ allowedTransitions:
+ [OverviewShownState.HIDDEN, OverviewShownState.SHOWING],
+ },
+ [OverviewShownState.SHOWING]: {
+ signal: 'showing',
+ allowedTransitions:
+ [OverviewShownState.SHOWN, OverviewShownState.HIDING],
+ },
+ [OverviewShownState.SHOWN]: {
+ signal: 'shown',
+ allowedTransitions: [OverviewShownState.HIDING],
+ },
+};
+
var Overview = class extends Signals.EventEmitter {
constructor() {
super();
this._modal = false; // have a modal grab
this._animationInProgress = false;
this._visibleTarget = false;
+ this._shownState = OverviewShownState.HIDDEN;
// During transitions, we raise this to the top to avoid having the overview
// area be reactive; it causes too many issues such as double clicks on
this._shellInfo.setMessage(text, options);
}
+ _changeShownState(state) {
+ const {allowedTransitions} =
+ OVERVIEW_SHOWN_TRANSITIONS[this._shownState];
+
+ if (!allowedTransitions.includes(state)) {
+ throw new Error('Invalid overview shown transition from ' +
+ `${this._shownState} to ${state}`);
+ }
+
+ this._shownState = state;
+ this.emit(OVERVIEW_SHOWN_TRANSITIONS[state].signal);
+ }
+
_onDragBegin() {
this._inXdndDrag = true;
Main.layoutManager.overviewGroup.set_child_above_sibling(
this._coverPane, null);
this._coverPane.show();
- this.emit('showing');
+ this._changeShownState(OverviewShownState.SHOWING);
Main.layoutManager.showOverview();
this._syncGrab();
if (endProgress === 0) {
this._shown = false;
this._visibleTarget = false;
- this.emit('hiding');
+ this._changeShownState(OverviewShownState.HIDING);
Main.panel.style = `transition-duration: ${duration}ms;`;
onComplete = () => this._hideDone();
} else {
this._coverPane.show();
this._overview.prepareToEnterOverview();
- this.emit('showing');
+ this._changeShownState(OverviewShownState.SHOWING);
this._overview.animateToOverview(state, () => this._showDone());
}
this._animationInProgress = false;
this._coverPane.hide();
- this.emit('shown');
+ this._changeShownState(OverviewShownState.SHOWN);
// Handle any calls to hide* while we were showing
if (!this._shown)
this._animateNotVisible();
this._coverPane.show();
this._overview.prepareToLeaveOverview();
- this.emit('hiding');
+ this._changeShownState(OverviewShownState.HIDING);
this._overview.animateFromOverview(() => this._hideDone());
}
// Handle any calls to show* while we were hiding
if (this._shown) {
- this.emit('hidden');
+ this._changeShownState(OverviewShownState.HIDDEN);
this._animateVisible(OverviewControls.ControlsState.WINDOW_PICKER);
} else {
Main.layoutManager.hideOverview();
- this.emit('hidden');
+ this._changeShownState(OverviewShownState.HIDDEN);
}
Main.panel.style = null;
Meta.disable_unredirect_for_display(global.display);
- this.emit('showing');
+ this._changeShownState(OverviewShownState.SHOWING);
this._overview.runStartupAnimation(() => {
if (!this._syncGrab()) {
}
Main.panel.style = null;
- this.emit('shown');
+ this._changeShownState(OverviewShownState.SHOWN);
callback();
});
}